<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="http://www.w3school.com.cn/jquery/jquery.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("#b01").click(function(){
                $.ajax({
                    url:"task",
                    async:false,
                    success:function (data) {
                        alert("success");
                        console.log(data)
                    }
                });
            });
        });
    </script>
</head>
<body>
<button id="b01" type="button">Example</button>

</body>
</html>